﻿<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
  <head>
    <title>读取cookie</title>
  </head>
  
  <body>
<%
    out.print("sessionid:" + session.getId());
    out.print("<br/>");
    Cookie[] cookies = request.getCookies();
    if (cookies != null) {
        for (int i=0; i<cookies.length; i++) {
            out.print("cookie name:" + cookies[i].getName());
            out.print("<br/>");
            out.print("cookie value:" + cookies[i].getValue());
            out.print("<br/>");
        }
    }
%>

  </body>
</html>
